home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1998 July / EnigmA AMIGA RUN 29 (1998)(G.R. Edizioni)(IT)[!][issue 1998-07 & 08].iso / recent / iib122.lha / IIB / Threads / Additional / IARexx.lha / SpiralLiteConical.irx < prev    next >
Text File  |  1997-03-19  |  4KB  |  142 lines

  1. /*
  2.        Imagine5.0 Arexx Conical Spiral Lightsource Creator
  3.  
  4.               "What use it is, I'll never know !!"
  5.  
  6.                              :-)
  7.  
  8.              1996 Rob Darke - Freely distributable
  9.     robda@parallel.demon.co.uk  or  iml@parallel.demon.co.uk
  10.  
  11. */
  12.  
  13. ADDRESS 'Imagine.1'
  14.  
  15. DISPLAYREXXPTR ON
  16.  
  17. NL = '0A'x
  18.  
  19. IF ~EXISTS('LIBS:rexxreqtools.library') THEN DO
  20.    NOTIFY 'Please install the rexxreqtools.library into your LIBS: directory'
  21.    NOTIFY 'It is available from /pub/aminet/util/rexx/RexxReqTools.lha'
  22.    CALL desist
  23. END
  24. CALL ADDLIB('rexxreqtools.library',0,-30,0)
  25.  
  26. IF ~EXISTS('LIBS:rexxmathlib.library') THEN DO
  27.    CALL rtezrequest('Please install the rexxmathlib.library into your LIBS: directory' || NL || NL ||,
  28.                     'The library is available from pub/aminet/util/rexx/RexxMathLib1.3.lha','Great, thanks!','Go get RexxMathLib.library','rt_reqpos = reqpos_centerscr')
  29.    CALL desist
  30. END
  31. CALL ADDLIB('rexxmathlib.library',0,-30,0)
  32.  
  33. CALL rtezrequest('Conical Spiral Lightsource Creator -  1996 Rob Darke','Wow!','Spiral Litez 2','rt_reqpos = reqpos_centerscr')
  34.  
  35. radius = rtgetlong(25,'Enter spiral radius','Spiral Radius',,'rt_reqpos = reqpos_centerscr')
  36.  
  37. if ~rtresult then CALL desist
  38.  
  39. distance = rtgetlong(100,'Enter spiral length','Spiral Length',,'rt_reqpos = reqpos_centerscr')
  40.  
  41. if ~rtresult then CALL desist
  42.  
  43. angle = rtgetlong(720,'Enter total rotation angle','Spiral Rotation',,'rt_reqpos = reqpos_centerscr')
  44.  
  45. if ~rtresult then CALL desist
  46.  
  47. lights = 0
  48. do while (lights = 0)
  49.    lights = rtgetlong(20,'Enter number of lightsources','Total Lightsources',,'rt_reqpos = reqpos_centerscr')
  50. end
  51.  
  52. if ~rtresult then CALL desist
  53.  
  54. totalred = rtgetlong(255,'Enter overall RED light level','Lightsource values',,'rt_reqpos = reqpos_centerscr')
  55.  
  56. if ~rtresult then CALL desist
  57.  
  58. totalgreen = rtgetlong(255,'Enter overall GREEN light level','Lightsource values',,'rt_reqpos = reqpos_centerscr')
  59.  
  60. if ~rtresult then CALL desist
  61.  
  62. totalblue = rtgetlong(255,'Enter overall BLUE light level','Lightsource  values',,'rt_reqpos = reqpos_centerscr')
  63.  
  64. if ~rtresult then CALL desist
  65.  
  66. axesname = rtgetstring('SPIRAL.LITE','Enter name for light objects','Object name',,'rt_reqpos = reqpos_centerscr')
  67.  
  68. if ~rtresult then CALL desist
  69.  
  70. ret = rtezrequest('I am going to create a spiral set of 'lights' lights' || NL ||,
  71.                   '           Radius = 'radius || NL ||,
  72.                   '           Length = 'distance || NL ||,
  73.                   '         Rotation = 'angle || NL ||,
  74.                   '        Total Red = 'totalred || NL ||,
  75.                   '      Total Green = 'totalgreen || NL ||,
  76.                   '       Total Blue = 'totalblue || NL ||,
  77.                   ' Object base name = 'axesname, ' _Ok | _Abort','Notification','rt_reqpos = reqpos_centerscr')
  78.  
  79. if ~ret then CALL desist
  80.  
  81. ret = rtezrequest('It is imperative that you don`t click anywhere whilst I`m' || NL ||,
  82.                   ' doing this, or else things will go very pear-shaped !!!','_Fair Enough | _Abort','Warning','rt_reqpos = reqpos_centerscr')
  83.  
  84. if ~ret then CALL desist
  85.  
  86.  
  87. /* So now lets begin ... won't this be fun ... */
  88.  
  89. singleangle = angle / (lights)
  90. singlestep = distance / (lights-1)
  91. stepin = radius / (lights -1)
  92.  
  93. pi = 3.141592654
  94. po = (pi * 2)
  95.  
  96. DETAILEDITOR
  97. ZOOM 1
  98. CENTERAT 0 0 0
  99. OBJECTMODE
  100. MULTIPICKOFF
  101.  
  102. do i = 0 to (lights-1)
  103.  
  104.    se = ((((singleangle*i) / 360)*po)-pi)
  105.    x = (radius * sin(se))
  106.    y = (radius * cos(se))
  107.    z = (i * singlestep)
  108.  
  109.    ADDAXIS
  110.    PICK
  111.    TRANSFORM_POSITION x y z
  112.    TRANSFORM_ALIGNMENT 90 0 0
  113.    ATTRIB.OBJECTNAME = axesname'.'i
  114.    SETATTRIBUTES OBJECTNAME
  115.    SETATTRIBUTES LIGHT
  116.  
  117.    radius = (radius - stepin)
  118.  
  119. end
  120.  
  121. ADDAXIS
  122. PICK
  123. TRANSFORM_ALIGNMENT 90 0 0
  124. TRANSFORMA_SIZE 0 (distance+100) 0
  125. ATTRIB.OBJECTNAME = 'GROUP.'axesname
  126. SETATTRIBUTES OBJECTNAME
  127. MULTIPICKON
  128. do i = 0 to (lights-1)
  129.    PICK axesname'.'i
  130. end
  131. MULTIPICKOFF
  132. GROUP
  133. GROUPMODE
  134. DISPLAYREXXPTR OFF
  135. CALL rtezrequest('Job done. Your set of 'lights' spiral lights awaits ...','Thanks Rob!','Spiral Litez 2','rt_reqpos = reqpos_centerscr')
  136. exit
  137.  
  138. desist: procedure
  139.    DISPLAYREXXPTR OFF
  140.    exit
  141. end
  142.